<template>
  <div>
    <van-nav-bar title="图文资讯" left-text="返回" left-arrow />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      class="list"
    >
      <div
        class="list-item"
        v-for="item in list"
        :key="item.id"
        @click="$router.push(`/xinwen/${item.id}`)"
      >
        <div class="item-left">
          <img :src="item.img_url" />
        </div>

        <div class="item-right">
          <span>{{ item.title }}</span>
          <br /><br />
          <br />
          <p>
            发售时间{{ item.add_time }} &nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;点击数:{{ item.click }}
          </p>
        </div>
      </div>
    </van-list>
  </div>
</template>

<script>
import { getxinwenzix } from "@/apis/category";

export default {
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
    };
  },
  async created() {
    const res = await getxinwenzix();
    console.log(res);
    this.list = res.data.message;
    console.log(this.list);

    this.jingcai();
  },
  methods: {},
};
</script>

<style lang="less" scoped>
.navbar {
  size: 13px;
  height: 30px;
  text-align: center;
  background-color: #26a2ff;
  color: #fff;
  line-height: 30px;
}
.list {
  .list-item {
    margin: 20px;
    width: 90%;
    display: flex;

    border-bottom: 1px solid pink;
    img {
      width: 50px;
      height: 50px;
    }
  }
  .item-right p {
    color: #26a2ff;
  }
}
</style>